{求助}VB编程实现加减运算

来源:百度知道 编辑:UC知道 时间:2024/05/25 06:02:16
用VBscript编写一程序完成加减运算,两个文本框输入加数与被加数,一个文本框输入运算符,一个文本框放结果,当鼠标单击结果框是自动根据输入框内容显示结果。

我没有学过VB,帮人请教,请高手把答案写在下面,谢谢!!!

'text1和text2放加数与被加数
'text3放运算符
Private Sub command1_click()
Select Case Text3.Text
Case "+"
s = Val(Text1.Text) + Val(Text2.Text)
Case "-"
s = Val(Text1.Text) - Val(Text2.Text)
Case "*"
s = Val(Text1.Text) * Val(Text2.Text)
Case "/"
s = Val(Text1.Text) / Val(Text2.Text)
End Select
Text4.Text = s
End Sub

#include<stdio.h>
int main(void)
{int a,b;
scanf ("%d%d",&a,&b);
printf ("%d",a+b);
}